package com.stylefeng.guns.common.sms.sdk;

import com.stylefeng.guns.common.sms.sdk.model.Result;
import com.stylefeng.guns.common.sms.sdk.model.SmsSingleSend;
import com.stylefeng.guns.common.sms.sdk.model.VoiceSend;

import java.net.URLEncoder;
import java.util.HashMap;
import java.util.Map;

/**
 * <pre>
 *    author  : xiej
 *    time    : 2018/2/113:09
 *    desc    : 输入描述
 *    version : v1.0
 * </pre>
 */
public class Test {

    public static void main(String[] args) throws Exception {
//        Map<String, String> params = new HashMap<String, String>();
//        params.put("apikey", "19eedcfb74875133fdbf5a9db0df6ce2");
//        params.put("text", "您好，订单编号ZT7315177923598821_物品，已到网点商户2网点1,请尽快来取。联系电话（1）。提货地址（提货地址） ");
//        params.put("mobile", "18959176009");
////        params.put("uid",  "1111");
////        params.put("callback_url",  "");
////        params.put("callback_url",  "");
//        YunpianClient yp = new YunpianClient().init();
//        Result<SmsSingleSend> sendResult= yp.sms().single_send(params);
        String ENCODING = "UTF-8";
        String tpl_value = URLEncoder.encode("#20#", ENCODING) + "=" +
                URLEncoder.encode("1234", ENCODING)+"&" +URLEncoder.encode("#21#", ENCODING) + "=" +
                URLEncoder.encode("1234", ENCODING)+"&"+URLEncoder.encode("#22#", ENCODING) + "=" +
                URLEncoder.encode("1234", ENCODING)+"&"+URLEncoder.encode("#23#", ENCODING) + "=" +
                URLEncoder.encode("1234", ENCODING);

        Map<String, String> params = new HashMap<String, String>();
        params.put("apikey", "19eedcfb74875133fdbf5a9db0df6ce2");
        params.put("tpl_value",tpl_value);
        params.put("mobile", "13615020535");
        params.put("tpl_id", "2179822");
//        params.put("tpl_value", tpl_value);
        params.put("uid",  "1111");
        params.put("callback_url",  "");
        params.put("callback_url",  "");
        YunpianClient yp = new YunpianClient().init();
        Result<VoiceSend> sendResult= yp.voice().tpl_notify(params);

       System.out.print(sendResult.getCode());
        yp.close();
    }
}
